package com.javandad.app.shared.entity;
import java.util.Date;

import javax.jdo.annotations.Extension;
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;

import com.javandad.app.shared.entity.search.SearchResult;

@PersistenceCapable
public class UserGroup implements java.io.Serializable, SearchResult {
	
	private static final long serialVersionUID = -7038486245603129502L;
	@SuppressWarnings("unused")
	private UserGroup(){}
	
	public UserGroup(String groupURL, Date dateOfEstablishment, String creator) {
		super();
		this.groupURL = groupURL;
		this.dateOfEstablishment = dateOfEstablishment;
		this.creator = creator;
	}
	
	public String getGroupURL() {
		return groupURL;
	}
	public Date getDateOfEstablishment() {
		return dateOfEstablishment;
	}
	public void setDateOfEstablishment(Date dateOfEstablishment) {
		this.dateOfEstablishment = dateOfEstablishment;
	}
	public String getCreator() {
		return creator;
	}
	public void setCreator(String creator) {
		this.creator = creator;
	}
	public String getEncodedKey() {
		return encodedKey;
	}
	
	
	
	public String getGroupFodoURL() {
		return groupFodoURL;
	}

	public void setGroupFodoURL(String groupFodoURL) {
		this.groupFodoURL = groupFodoURL;
	}

	@Override
	public String toString() {
		return groupURL;
	}
	
	@PrimaryKey
	@Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
	@Extension(vendorName = "datanucleus", key = "gae.encoded-pk", value = "true")
	private String encodedKey;
	@Persistent
	@Extension(vendorName="datanucleus", key="gae.pk-name", value="true")
	private String groupURL;
	
	@Persistent
	private Date dateOfEstablishment;
	@Persistent
	private String creator;
	
	private String groupFodoURL = "/img/icons/group_default_pic.png";
	@Override
	public Type getSearchResultType() {
		return SearchResult.Type.Group;
	}
}
